<template>
  <form   :class="style__">
    <div class="form-group">
      <label class="col-sm-12 control-label">客户名称</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_user_name" maxlength="10" class="form-control"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">联系电话</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_user_phone" maxlength="15" class="form-control"/>
        <a href="#" class="btn btn-primary" @click="applyNewPhone">修改电话</a>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">小区名称</label>
      <div class="col-sm-12">
        <input type="text" v-model="f_residential_area" maxlength="100" class="form-control"/>
        <a href="#" class="btn btn-primary" @click="applyNewArea">修改小区</a>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">详细住址</label>
      <div class="col-sm-12">
        <input type="text"  v-model="f_address" maxlength="200" class="form-control"/>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">房屋结构</label>
      <div class="col-sm-12">
        <radio-group :value.sync="f_room_style" type="success" buttons="false">
          <radio value="地上">地上</radio>
          <radio value="半地下">半地下</radio>
          <radio value="地下">地下</radio>
          <radio value="楼顶">楼顶</radio>
        </radio-group>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-12 control-label">用户类型</label>
      <div class="col-sm-12">
        <radio-group :value.sync="f_noncivil_style" type="success" buttons="false">
          <radio value="餐饮用户">餐饮用户</radio>
          <radio value="公福用户">公福用户</radio>
          <radio value="锅炉用户">锅炉用户</radio>
          <radio value="工业用户">工业用户</radio>
        </radio-group>
      </div>
    </div>
    <div style="height:50px;"></div>
  </form>
</template>

<script>
import Vue from 'vue'
import RadioGroup from 'vue-strap/src/radioGroup'
import Radio from 'vue-strap/src/radioBtn'

export default {
  title: '工商用户基本信息',
  data() {
    return this.$parent.$parent.data
  },
  methods: {
    applyNewPhone() {
      let self = this
      let criteria = 'f_user_phone=\'' + this.f_user_phone + '\''
      this.$post(Vue.url + 'logic/现场修改电话',
      {data:{id: this.f_check_item_id, f_plan_id:this.f_check_plan_id, f_condition: criteria}},
      {resolveMsg: null, rejectMsg: null}).then(
          (response) => {
            HostApp.updateUserPhone(self.f_check_item_id, criteria)
            HostApp.alert('修改电话成功')
          }
        ).catch(
          (response) => {
            HostApp.alert('修改电话失败')
          }
        )
    },
    applyNewArea() {
      let self = this
      let criteria = 'f_residential_area=\'' + this.f_residential_area + '\''
      this.$post(Vue.url + 'logic/现场修改电话',
      {data:{id: this.f_check_item_id, f_plan_id:this.f_check_plan_id, f_condition: criteria}},
      {resolveMsg: null, rejectMsg: null}).then(
          (response) => {
            HostApp.updateUserPhone(self.f_check_item_id, criteria)
            HostApp.alert('修改小区成功')
          }
        ).catch(
          (response) => {
            HostApp.alert('修改小区失败')
          }
        )
    }
  }
}
</script>
